home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / AIncludes / Menus.a < prev    next >
Text File  |  1996-05-01  |  12KB  |  572 lines

  1. ;
  2. ;    File:        Menus.a
  3. ;
  4. ;    Contains:    Menu Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Release:    Universal Interfaces 3.0d3 on Copland DR1
  8. ;
  9. ;    Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10. ;
  11. ;    Bugs?:        If you find a problem with this file, send the file and version
  12. ;                information (from above) and the problem description to:
  13. ;
  14. ;                    Internet:    apple.bugs@applelink.apple.com
  15. ;                    AppleLink:    APPLE.BUGS
  16. ;
  17. ;
  18.     IF &TYPE('__MENUS__') = 'UNDEFINED' THEN
  19. __MENUS__ SET 1
  20.  
  21.     IF &TYPE('__MEMORY__') = 'UNDEFINED' THEN
  22.     include 'Memory.a'
  23.     ENDIF
  24.     IF &TYPE('__QUICKDRAW__') = 'UNDEFINED' THEN
  25.     include 'Quickdraw.a'
  26.     ENDIF
  27.     IF FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED THEN
  28.  
  29. noMark                            EQU        0                    ;mark symbol for MarkItem
  30.                                                             ; menu defProc messages 
  31. mDrawMsg                        EQU        0
  32. mChooseMsg                        EQU        1
  33. mSizeMsg                        EQU        2
  34. mDrawItemMsg                    EQU        4
  35. mCalcItemMsg                    EQU        5
  36. textMenuProc                    EQU        0
  37. hMenuCmd                        EQU        27                    ;itemCmd == 0x001B ==> hierarchical menu
  38. hierMenu                        EQU        -1                    ;a hierarchical menu - for InsertMenu call
  39. mPopUpMsg                        EQU        3                    ;menu defProc messages - place yourself
  40. mctAllItems                        EQU        -98                    ;search for all Items for the given ID
  41. mctLastIDIndic                    EQU        -99                    ;last color table entry has this in ID field
  42. MenuInfo                RECORD 0
  43. menuID                     ds.w    1                ; offset: $0 (0)
  44. menuWidth                 ds.w    1                ; offset: $2 (2)
  45. menuHeight                 ds.w    1                ; offset: $4 (4)
  46. menuProc                 ds.l    1                ; offset: $6 (6)
  47. enableFlags                 ds.l    1                ; offset: $A (10)
  48. menuData                 ds        Str255            ; offset: $E (14)
  49. sizeof                     EQU *                    ; size:   $10E (270)
  50.                         ENDR
  51. ; typedef struct MenuInfo *                MenuPtr
  52.  
  53. ; typedef MenuPtr *                        MenuHandle
  54.  
  55. ; typedef MenuHandle                     MenuRef
  56.  
  57. MCEntry                    RECORD 0
  58. mctID                     ds.w    1                ; offset: $0 (0)        ; menu ID.  ID = 0 is the menu bar
  59. mctItem                     ds.w    1                ; offset: $2 (2)        ; menu Item. Item = 0 is a title
  60. mctRGB1                     ds        RGBColor        ; offset: $4 (4)        ; usage depends on ID and Item
  61. mctRGB2                     ds        RGBColor        ; offset: $A (10)        ; usage depends on ID and Item
  62. mctRGB3                     ds        RGBColor        ; offset: $10 (16)        ; usage depends on ID and Item
  63. mctRGB4                     ds        RGBColor        ; offset: $16 (22)        ; usage depends on ID and Item
  64. mctReserved                 ds.w    1                ; offset: $1C (28)        ; reserved for internal use
  65. sizeof                     EQU *                    ; size:   $1E (30)
  66.                         ENDR
  67. ; typedef struct MCEntry *                MCEntryPtr
  68.  
  69. MCTable                    RECORD 0
  70. elements                 ds.b    1 * MCEntry.sizeof
  71. sizeof                     EQU *                    ; size:   $1E (30)
  72.                         ENDR
  73.  
  74.  
  75. ; typedef struct MCEntry *                MCTablePtr
  76.  
  77. ; typedef MCTablePtr *                    MCTableHandle
  78.  
  79. MenuCRsrc                RECORD 0
  80. numEntries                 ds.w    1                ; offset: $0 (0)        ; number of entries
  81. mcEntryRecs                 ds        MCTable            ; offset: $2 (2)        ; ARRAY [1..numEntries] of MCEntry
  82. sizeof                     EQU *                    ; size:   $20 (32)
  83.                         ENDR
  84. ; typedef struct MenuCRsrc *            MenuCRsrcPtr
  85.  
  86. ; typedef MenuCRsrcPtr *                MenuCRsrcHandle
  87.  
  88. ;
  89. ; pascal short GetMBarHeight(void)
  90. ;
  91.     IF ¨ GENERATINGCFM THEN
  92.         Macro
  93.         _GetMBarHeight        &dest=(sp)
  94.             move.w            $0BAA,&dest
  95.         EndM
  96.     ELSE
  97.         IMPORT_CFM_FUNCTION GetMBarHeight
  98.     ENDIF
  99.  
  100. ;
  101. ; pascal MenuRef NewMenu(short menuID, ConstStr255Param menuTitle)
  102. ;
  103.     IF ¨ GENERATINGCFM THEN
  104.         _NewMenu:    OPWORD    $A931
  105.     ELSE
  106.         IMPORT_CFM_FUNCTION NewMenu
  107.     ENDIF
  108.  
  109. ;
  110. ; pascal MenuRef GetMenu(short resourceID)
  111. ;
  112.     IF ¨ GENERATINGCFM THEN
  113.         _GetMenu:    OPWORD    $A9BF
  114.     ELSE
  115.         IMPORT_CFM_FUNCTION GetMenu
  116.     ENDIF
  117.  
  118. ;
  119. ; pascal void AppendMenu(MenuRef menu, ConstStr255Param data)
  120. ;
  121.     IF ¨ GENERATINGCFM THEN
  122.         _AppendMenu:    OPWORD    $A933
  123.     ELSE
  124.         IMPORT_CFM_FUNCTION AppendMenu
  125.     ENDIF
  126.  
  127. ;
  128. ; pascal void InsertMenu(MenuRef theMenu, short beforeID)
  129. ;
  130.     IF ¨ GENERATINGCFM THEN
  131.         _InsertMenu:    OPWORD    $A935
  132.     ELSE
  133.         IMPORT_CFM_FUNCTION InsertMenu
  134.     ENDIF
  135.  
  136. ;
  137. ; pascal void DeleteMenu(short menuID)
  138. ;
  139.     IF ¨ GENERATINGCFM THEN
  140.         _DeleteMenu:    OPWORD    $A936
  141.     ELSE
  142.         IMPORT_CFM_FUNCTION DeleteMenu
  143.     ENDIF
  144.  
  145. ;
  146. ; pascal void AppendResMenu(MenuRef theMenu, ResType theType)
  147. ;
  148.     IF ¨ GENERATINGCFM THEN
  149.         _AppendResMenu:    OPWORD    $A94D
  150.     ELSE
  151.         IMPORT_CFM_FUNCTION AppendResMenu
  152.     ENDIF
  153.  
  154. ;
  155. ; pascal void InsertMenuItem(MenuRef theMenu, ConstStr255Param itemString, short afterItem)
  156. ;
  157.     IF ¨ GENERATINGCFM THEN
  158.         _InsertMenuItem:    OPWORD    $A826
  159.     ELSE
  160.         IMPORT_CFM_FUNCTION InsertMenuItem
  161.     ENDIF
  162.  
  163. ;
  164. ; pascal void SetMenuItemText(MenuRef theMenu, short item, ConstStr255Param itemString)
  165. ;
  166.     IF ¨ GENERATINGCFM THEN
  167.         _SetMenuItemText:    OPWORD    $A947
  168.     ELSE
  169.         IMPORT_CFM_FUNCTION SetMenuItemText
  170.     ENDIF
  171.  
  172. ;
  173. ; pascal void GetMenuItemText(MenuRef theMenu, short item, Str255 itemString)
  174. ;
  175.     IF ¨ GENERATINGCFM THEN
  176.         _GetMenuItemText:    OPWORD    $A946
  177.     ELSE
  178.         IMPORT_CFM_FUNCTION GetMenuItemText
  179.     ENDIF
  180.  
  181. ;
  182. ; pascal void SetItemMark(MenuRef theMenu, short item, CharParameter markChar)
  183. ;
  184.     IF ¨ GENERATINGCFM THEN
  185.         _SetItemMark:    OPWORD    $A944
  186.     ELSE
  187.         IMPORT_CFM_FUNCTION SetItemMark
  188.     ENDIF
  189.  
  190. ;
  191. ; pascal void GetItemMark(MenuRef theMenu, short item, CharParameter *markChar)
  192. ;
  193.     IF ¨ GENERATINGCFM THEN
  194.         _GetItemMark:    OPWORD    $A943
  195.     ELSE
  196.         IMPORT_CFM_FUNCTION GetItemMark
  197.     ENDIF
  198.  
  199. ;
  200. ; pascal void SetItemCmd(MenuRef theMenu, short item, CharParameter cmdChar)
  201. ;
  202.     IF ¨ GENERATINGCFM THEN
  203.         _SetItemCmd:    OPWORD    $A84F
  204.     ELSE
  205.         IMPORT_CFM_FUNCTION SetItemCmd
  206.     ENDIF
  207.  
  208. ;
  209. ; pascal void GetItemCmd(MenuRef theMenu, short item, CharParameter *cmdChar)
  210. ;
  211.     IF ¨ GENERATINGCFM THEN
  212.         _GetItemCmd:    OPWORD    $A84E
  213.     ELSE
  214.         IMPORT_CFM_FUNCTION GetItemCmd
  215.     ENDIF
  216.  
  217. ;
  218. ; pascal void SetItemIcon(MenuRef theMenu, short item, short iconIndex)
  219. ;
  220.     IF ¨ GENERATINGCFM THEN
  221.         _SetItemIcon:    OPWORD    $A940
  222.     ELSE
  223.         IMPORT_CFM_FUNCTION SetItemIcon
  224.     ENDIF
  225.  
  226. ;
  227. ; pascal void GetItemIcon(MenuRef theMenu, short item, short *iconIndex)
  228. ;
  229.     IF ¨ GENERATINGCFM THEN
  230.         _GetItemIcon:    OPWORD    $A93F
  231.     ELSE
  232.         IMPORT_CFM_FUNCTION GetItemIcon
  233.     ENDIF
  234.  
  235. ;
  236. ; pascal void SetItemStyle(MenuRef theMenu, short item, StyleParameter chStyle)
  237. ;
  238.     IF ¨ GENERATINGCFM THEN
  239.         _SetItemStyle:    OPWORD    $A942
  240.     ELSE
  241.         IMPORT_CFM_FUNCTION SetItemStyle
  242.     ENDIF
  243.  
  244. ;
  245. ; pascal void GetItemStyle(MenuRef theMenu, short item, Style *chStyle)
  246. ;
  247.     IF ¨ GENERATINGCFM THEN
  248.         _GetItemStyle:    OPWORD    $A941
  249.     ELSE
  250.         IMPORT_CFM_FUNCTION GetItemStyle
  251.     ENDIF
  252.  
  253. ;
  254. ; pascal MenuRef GetMenuHandle(short menuID)
  255. ;
  256.     IF ¨ GENERATINGCFM THEN
  257.         _GetMenuHandle:    OPWORD    $A949
  258.     ELSE
  259.         IMPORT_CFM_FUNCTION GetMenuHandle
  260.     ENDIF
  261.  
  262. ;
  263. ; pascal void CalcMenuSize(MenuRef theMenu)
  264. ;
  265.     IF ¨ GENERATINGCFM THEN
  266.         _CalcMenuSize:    OPWORD    $A948
  267.     ELSE
  268.         IMPORT_CFM_FUNCTION CalcMenuSize
  269.     ENDIF
  270.  
  271. ;
  272. ; pascal void DisableItem(MenuRef theMenu, short item)
  273. ;
  274.     IF ¨ GENERATINGCFM THEN
  275.         _DisableItem:    OPWORD    $A93A
  276.     ELSE
  277.         IMPORT_CFM_FUNCTION DisableItem
  278.     ENDIF
  279.  
  280. ;
  281. ; pascal void EnableItem(MenuRef theMenu, short item)
  282. ;
  283.     IF ¨ GENERATINGCFM THEN
  284.         _EnableItem:    OPWORD    $A939
  285.     ELSE
  286.         IMPORT_CFM_FUNCTION EnableItem
  287.     ENDIF
  288.  
  289. ;
  290. ; pascal void FlashMenuBar(short menuID)
  291. ;
  292.     IF ¨ GENERATINGCFM THEN
  293.         _FlashMenuBar:    OPWORD    $A94C
  294.     ELSE
  295.         IMPORT_CFM_FUNCTION FlashMenuBar
  296.     ENDIF
  297.  
  298. ;
  299. ; pascal long PopUpMenuSelect(MenuRef menu, short top, short left, short popUpItem)
  300. ;
  301.     IF ¨ GENERATINGCFM THEN
  302.         _PopUpMenuSelect:    OPWORD    $A80B
  303.     ELSE
  304.         IMPORT_CFM_FUNCTION PopUpMenuSelect
  305.     ENDIF
  306.  
  307. ;
  308. ; pascal void DeleteMCEntries(short menuID, short menuItem)
  309. ;
  310.     IF ¨ GENERATINGCFM THEN
  311.         _DeleteMCEntries:    OPWORD    $AA60
  312.     ELSE
  313.         IMPORT_CFM_FUNCTION DeleteMCEntries
  314.     ENDIF
  315.  
  316. ;
  317. ; pascal MCTableHandle GetMCInfo(void )
  318. ;
  319.     IF ¨ GENERATINGCFM THEN
  320.         _GetMCInfo:    OPWORD    $AA61
  321.     ELSE
  322.         IMPORT_CFM_FUNCTION GetMCInfo
  323.     ENDIF
  324.  
  325. ;
  326. ; pascal void SetMCInfo(MCTableHandle menuCTbl)
  327. ;
  328.     IF ¨ GENERATINGCFM THEN
  329.         _SetMCInfo:    OPWORD    $AA62
  330.     ELSE
  331.         IMPORT_CFM_FUNCTION SetMCInfo
  332.     ENDIF
  333.  
  334. ;
  335. ; pascal void DisposeMCInfo(MCTableHandle menuCTbl)
  336. ;
  337.     IF ¨ GENERATINGCFM THEN
  338.         _DisposeMCInfo:    OPWORD    $AA63
  339.     ELSE
  340.         IMPORT_CFM_FUNCTION DisposeMCInfo
  341.     ENDIF
  342.  
  343. ;
  344. ; pascal MCEntryPtr GetMCEntry(short menuID, short menuItem)
  345. ;
  346.     IF ¨ GENERATINGCFM THEN
  347.         _GetMCEntry:    OPWORD    $AA64
  348.     ELSE
  349.         IMPORT_CFM_FUNCTION GetMCEntry
  350.     ENDIF
  351.  
  352. ;
  353. ; pascal void SetMCEntries(short numEntries, MCTablePtr menuCEntries)
  354. ;
  355.     IF ¨ GENERATINGCFM THEN
  356.         _SetMCEntries:    OPWORD    $AA65
  357.     ELSE
  358.         IMPORT_CFM_FUNCTION SetMCEntries
  359.     ENDIF
  360.  
  361. ;
  362. ; pascal void DrawMenuBar(void )
  363. ;
  364.     IF ¨ GENERATINGCFM THEN
  365.         _DrawMenuBar:    OPWORD    $A937
  366.     ELSE
  367.         IMPORT_CFM_FUNCTION DrawMenuBar
  368.     ENDIF
  369.  
  370. ;
  371. ; pascal void InvalMenuBar(void )
  372. ;
  373.     IF ¨ GENERATINGCFM THEN
  374.         _InvalMenuBar:    OPWORD    $A81D
  375.     ELSE
  376.         IMPORT_CFM_FUNCTION InvalMenuBar
  377.     ENDIF
  378.  
  379. ;
  380. ; pascal void InitProcMenu(short resID)
  381. ;
  382.     IF ¨ GENERATINGCFM THEN
  383.         _InitProcMenu:    OPWORD    $A808
  384.     ELSE
  385.         IMPORT_CFM_FUNCTION InitProcMenu
  386.     ENDIF
  387.  
  388. ;
  389. ; pascal Handle GetMenuBar(void )
  390. ;
  391.     IF ¨ GENERATINGCFM THEN
  392.         _GetMenuBar:    OPWORD    $A93B
  393.     ELSE
  394.         IMPORT_CFM_FUNCTION GetMenuBar
  395.     ENDIF
  396.  
  397. ;
  398. ; pascal void SetMenuBar(Handle menuList)
  399. ;
  400.     IF ¨ GENERATINGCFM THEN
  401.         _SetMenuBar:    OPWORD    $A93C
  402.     ELSE
  403.         IMPORT_CFM_FUNCTION SetMenuBar
  404.     ENDIF
  405.  
  406. ;
  407. ; pascal Boolean SystemEdit(short editCmd)
  408. ;
  409.     IF ¨ GENERATINGCFM THEN
  410.         _SystemEdit:    OPWORD    $A9C2
  411.     ELSE
  412.         IMPORT_CFM_FUNCTION SystemEdit
  413.     ENDIF
  414.  
  415. ;
  416. ; pascal void SystemMenu(long menuResult)
  417. ;
  418.     IF ¨ GENERATINGCFM THEN
  419.         _SystemMenu:    OPWORD    $A9B5
  420.     ELSE
  421.         IMPORT_CFM_FUNCTION SystemMenu
  422.     ENDIF
  423.  
  424. ;
  425. ; pascal Handle GetNewMBar(short menuBarID)
  426. ;
  427.     IF ¨ GENERATINGCFM THEN
  428.         _GetNewMBar:    OPWORD    $A9C0
  429.     ELSE
  430.         IMPORT_CFM_FUNCTION GetNewMBar
  431.     ENDIF
  432.  
  433. ;
  434. ; pascal void ClearMenuBar(void )
  435. ;
  436.     IF ¨ GENERATINGCFM THEN
  437.         _ClearMenuBar:    OPWORD    $A934
  438.     ELSE
  439.         IMPORT_CFM_FUNCTION ClearMenuBar
  440.     ENDIF
  441.  
  442. ;
  443. ; pascal void CheckItem(MenuRef theMenu, short item, Boolean checked)
  444. ;
  445.     IF ¨ GENERATINGCFM THEN
  446.         _CheckItem:    OPWORD    $A945
  447.     ELSE
  448.         IMPORT_CFM_FUNCTION CheckItem
  449.     ENDIF
  450.  
  451. ;
  452. ; pascal short CountMItems(MenuRef theMenu)
  453. ;
  454.     IF ¨ GENERATINGCFM THEN
  455.         _CountMItems:    OPWORD    $A950
  456.     ELSE
  457.         IMPORT_CFM_FUNCTION CountMItems
  458.     ENDIF
  459.  
  460. ;
  461. ; pascal void SetMenuFlash(short count)
  462. ;
  463.     IF ¨ GENERATINGCFM THEN
  464.         _SetMenuFlash:    OPWORD    $A94A
  465.     ELSE
  466.         IMPORT_CFM_FUNCTION SetMenuFlash
  467.     ENDIF
  468.  
  469. ;
  470. ; pascal void InitMenus(void )
  471. ;
  472.     IF ¨ GENERATINGCFM THEN
  473.         _InitMenus:    OPWORD    $A930
  474.     ELSE
  475.         IMPORT_CFM_FUNCTION InitMenus
  476.     ENDIF
  477.  
  478.     IF OLDROUTINENAMES THEN
  479.     ENDIF
  480. ;
  481. ; pascal long MenuKey(CharParameter ch)
  482. ;
  483.     IF ¨ GENERATINGCFM THEN
  484.         _MenuKey:    OPWORD    $A93E
  485.     ELSE
  486.         IMPORT_CFM_FUNCTION MenuKey
  487.     ENDIF
  488.  
  489. ;
  490. ; pascal long MenuSelect(Point startPt)
  491. ;
  492.     IF ¨ GENERATINGCFM THEN
  493.         _MenuSelect:    OPWORD    $A93D
  494.     ELSE
  495.         IMPORT_CFM_FUNCTION MenuSelect
  496.     ENDIF
  497.  
  498. ;
  499. ; pascal long MenuChoice(void )
  500. ;
  501.     IF ¨ GENERATINGCFM THEN
  502.         _MenuChoice:    OPWORD    $AA66
  503.     ELSE
  504.         IMPORT_CFM_FUNCTION MenuChoice
  505.     ENDIF
  506.  
  507. ;
  508. ; pascal void DisposeMenu(MenuRef theMenu)
  509. ;
  510.     IF ¨ GENERATINGCFM THEN
  511.         _DisposeMenu:    OPWORD    $A932
  512.     ELSE
  513.         IMPORT_CFM_FUNCTION DisposeMenu
  514.     ENDIF
  515.  
  516. ;
  517. ; pascal void DeleteMenuItem(MenuRef theMenu, short item)
  518. ;
  519.     IF ¨ GENERATINGCFM THEN
  520.         _DeleteMenuItem:    OPWORD    $A952
  521.     ELSE
  522.         IMPORT_CFM_FUNCTION DeleteMenuItem
  523.     ENDIF
  524.  
  525. ;
  526. ; pascal void HiliteMenu(short menuID)
  527. ;
  528.     IF ¨ GENERATINGCFM THEN
  529.         _HiliteMenu:    OPWORD    $A938
  530.     ELSE
  531.         IMPORT_CFM_FUNCTION HiliteMenu
  532.     ENDIF
  533.  
  534. ;
  535. ; pascal void InsertResMenu(MenuRef theMenu, ResType theType, short afterItem)
  536. ;
  537.     IF ¨ GENERATINGCFM THEN
  538.         _InsertResMenu:    OPWORD    $A951
  539.     ELSE
  540.         IMPORT_CFM_FUNCTION InsertResMenu
  541.     ENDIF
  542.  
  543. ;
  544. ; pascal void InsertFontResMenu(MenuRef theMenu, short afterItem, short scriptFilter)
  545. ;
  546.     IF ¨ GENERATINGCFM THEN
  547.         Macro
  548.         _InsertFontResMenu
  549.             move.w              #$0400,D0
  550.             dc.w                $A825
  551.         EndM
  552.     ELSE
  553.         IMPORT_CFM_FUNCTION InsertFontResMenu
  554.     ENDIF
  555.  
  556. ;
  557. ; pascal void InsertIntlResMenu(MenuRef theMenu, ResType theType, short afterItem, short scriptFilter)
  558. ;
  559.     IF ¨ GENERATINGCFM THEN
  560.         Macro
  561.         _InsertIntlResMenu
  562.             move.w              #$0601,D0
  563.             dc.w                $A825
  564.         EndM
  565.     ELSE
  566.         IMPORT_CFM_FUNCTION InsertIntlResMenu
  567.     ENDIF
  568.  
  569.     ENDIF
  570.     ENDIF ; __MENUS__ 
  571.  
  572.